﻿<UserControl x:Class="AtletIS.UI.Views.StartListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv="clr-namespace:AtletIS.UI.Converters"
             xmlns:controls="clr-namespace:AtletIS.UI.Controls"
             xmlns:vm="clr-namespace:AtletIS.UI.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="1000">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/DataTemplatesDictionary.xaml" />
                <ResourceDictionary Source="../Resources/ScrollBarDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <controls:RoundedBox />
        <Grid Margin="10">
            
            <Grid.Resources>
                <conv:BoolInverterConverter x:Key="MyBoolInverterConverter" />
                <conv:BoolToVisibilityConverter x:Key="MyBoolToVisibilityConverter" />
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="65"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>

            <!-- Header -->
            <Border Grid.Row="0" Style="{StaticResource LightSteelBlueBorder}" Margin="5" Padding="25,0">
                <Grid>
                    <TextBlock Grid.Column="0" Text="{Binding Path=ActiveDisciplineList.Name}" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource BigStellBlueText}" />
                    <TextBlock Grid.Column="1" Text="START LIST" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource BigStellBlueText}" />
                </Grid>
            </Border>
        
            <!-- Content -->
            <ScrollViewer Grid.Row="1" Margin="5" VerticalScrollBarVisibility="Auto">
                <ItemsControl ItemsSource="{Binding Path=StartList}" ItemTemplate="{StaticResource ResourceKey=StartListItemTemplate}" />
            </ScrollViewer>
        
            <!-- Footer -->
            <Border Grid.Row="2"  Style="{StaticResource LightSteelBlueBorder}" Margin="5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="150"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                        <TextBlock Text="Competitors: " Style="{StaticResource SmallSteelBlueText}" />
                        <TextBlock Text="{Binding Path=TotalCount}" Style="{StaticResource SmallSteelBlueText}" />
                    </StackPanel>
                    <TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Style="{StaticResource MediumSteelBlueText}" Text="Powered by AtletIS" />
                    <StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"
                                Visibility="{Binding HasPages, Converter={StaticResource MyBoolToVisibilityConverter}}">
                        <TextBlock Text="Page: " Style="{StaticResource SmallSteelBlueText}" />
                        <TextBlock Text="{Binding Path=Page}" Style="{StaticResource SmallSteelBlueText}" />
                        <TextBlock Text=" / " Style="{StaticResource SmallSteelBlueText}" />
                        <TextBlock Text="{Binding Path=PageCount}" Style="{StaticResource SmallSteelBlueText}" />
                    </StackPanel>
                </Grid>
            </Border>
        
            <!-- Paging -->
            <Border Grid.Row="3" HorizontalAlignment="Right" Margin="5,5,30,5" Style="{StaticResource LightSteelBlueBorder}" 
                    Visibility="{Binding HasPages, Converter={StaticResource MyBoolToVisibilityConverter}}">
                <StackPanel Orientation="Horizontal">
                    <RadioButton Template="{StaticResource PagingButton}" Content="Prev" Command="{Binding Path=PrevPageCommand}" />
                    <RadioButton Template="{StaticResource PagingButton}" Content="Next" Command="{Binding Path=NextPageCommand}" />
                </StackPanel>
            </Border>
        
        </Grid>
    </Grid>
</UserControl>
